From 662df8ebf238b2caec0e962705059db4b04b31de Mon Sep 17 00:00:00 2001 From: Alfie John Date: Mon, 13 Apr 2015 22:36:32 +1000 Subject: [PATCH] docs: fix shared library compilation error Currently getting: note: /usr/bin/ld: /home/alfie/tmp/test/target/debug/build/test-39af07f97c17512a/out/libhello.a(hello.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC --- src/doc/build-script.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/build-script.md b/src/doc/build-script.md index 61c484078..c00362de4 100644 --- a/src/doc/build-script.md +++ b/src/doc/build-script.md @@ -312,7 +312,7 @@ fn main() { // note that there are a number of downsides to this approach, the comments // below detail how to improve the portability of these commands. - Command::new("gcc").args(&["src/hello.c", "-c", "-o"]) + Command::new("gcc").args(&["src/hello.c", "-c", "-fPIC", "-o"]) .arg(&format!("{}/hello.o", out_dir)) .status().unwrap(); Command::new("ar").args(&["crus", "libhello.a", "hello.o"]) -- 2.30.2